using System;

using NUnit.Framework;

namespace HabilisDesign.Iota.UnitTests
{
    [TestFixture]
    public class UserTests
    {
        [Test]
        public void TestConstructorDecodesXml()
        {
            string testXml = "<user><id>12345678</id><name>testuser</name><screen_name>Test User</screen_name><location>Flower Mound, Texas</location><description>Bent on adding beauty to the world</description><profile_image_url>http://assets3.twitter.com/system/user/profile_image/12345678/normal/pic.png?1171960310</profile_image_url><url>http://testing.com</url><protected>false</protected><status><created_at>Thu Apr 12 12:48:05 +0000 2007</created_at><id>12345678</id><text>This is a test status. Are you getting it??</text></status></user>";
            User testUser = User.Parse( testXml );
            Assert.AreEqual( "12345678", testUser.Id );
            Assert.AreEqual( "testuser", testUser.Name );
            Assert.AreEqual( "Test User", testUser.ScreenName );
            Assert.AreEqual( "Flower Mound, Texas", testUser.Location );
            Assert.AreEqual( "Bent on adding beauty to the world", testUser.Description );
            Assert.AreEqual( new Uri( "http://assets3.twitter.com/system/user/profile_image/12345678/normal/pic.png?1171960310" ), testUser.ProfileImage );
            Assert.AreEqual( new Uri( "http://testing.com" ), testUser.Url );
            Assert.IsFalse( testUser.Protected );
            Assert.IsNotNull( testUser.CurrentStatus );
            Assert.AreEqual( "12345678", testUser.CurrentStatus.Id );
        }

    } // end class

} // end namespace
